import request, {
  Method,
  buyerUrl,
  commonUrl,
  managerUrl,
  sellerUrl,
  expertUrl,
} from "@/plugins/request.js";


/**
 * 获取首页商品10 固定死 随机 
 * @param {} params 
 * @returns 
 */
 export const getIndexGoods=()=>{
  return request({
    url: buyerUrl+'/buyer/goods/goods/es',
    method: Method.GET,
    needToken: false,
    params:{
      pageSize:12,
      pageNumber:1
    }
  })
}

//密码登录接口
export function login(params) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/userLogin`,
    method: Method.POST,
    needToken: false,
    params,
  });
}

//获取手机验证码接口
export function getCode(params) {
  return request({
    url: `${commonUrl}/common/common/sms/${params.verificationEnums}/${params.mobile}`,
    method: Method.GET,
    needToken: true,
  });
}

//验证码登录
export function codeLogin(params) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/smsLogin`,
    method: Method.POST,
    needToken: true,
    params,
  });
}

//获取用户信息
export function userInfo(params) {
  return request({
    url: `${buyerUrl}/buyer/passport/member`,
    method: Method.GET,
    needToken: true,
  });
}

//上传文件
export function onLoadFile(data) {
  return request({
    url: `${commonUrl}/common/common/upload/file`,
    method: Method.POST,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    needToken: true,
    data,
  });
}

// 获取未读信息
  export function getUnreadNews() {
    return request({
      url: `${buyerUrl}/buyer/message/member/unreadCount`,
      method: Method.GET,
      needToken: true,
    });
  }

  // 获取未读信息列表
  export function getUnreadList(params) {
    return request({
      url: `${buyerUrl}/buyer/message/member`,
      method: Method.GET,
      needToken: true,
      params,
    });
  }
 
  // 信息已读
  export function readMsg(id) {
    return request({
      url: `${buyerUrl}/buyer/message/member/${id}`,
      method: Method.PUT,
      needToken: true,
    });
  }

//首页获取banner轮播图
export function getShuffling(type) {
  return request({
    // url: `${managerUrl}/manager/home/setting/getHomePics`,
    url: `${managerUrl}/manager/home/setting/getCurrentHomePics/${type}`,
    method: Method.GET,
    needToken: true,
  });
}

//条件查询
export function getConditionQuery(data) {
  return request({
    url: `${expertUrl}/expert/course/courseSeries/byPage`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

//课程中心课程类别
export function getCourseType() {
  return request({
    url: `${expertUrl}/expert/course/courseCategory/list`,
    method: Method.GET,
    needToken: true,
  });
}

//课程详情
export function getCourseIntroduce(params) {
  return request({
    url: `${expertUrl}/expert/course/courseSeries/${params.id}`,
    method: Method.GET,
    needToken: true,
  });
}

//课程推荐
export function getCourseRecommended(data) {
  return request({
    url: `${expertUrl}/expert/course/courseSeries/courseRecommendation`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

//获取运动目的
export function getSport(data) {
  return request({
    url: `${commonUrl}/common/common/enum/dataList`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

//注册账号
export function registered(data) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/register`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    data,
  });
}

//通过id查询是否存在该用户
export function getIsExist(data) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/isExists`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    data,
  });
}

//在线咨询
export function getExpertList(data) {
  return request({
    url: `${expertUrl}/expert/expert/expert/PC/expertSortList`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

//在线咨询查询咨询人
export function searchConsultant(data) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/user/findRelationUser`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
  });
}

//添加咨询人
export function addConsultant(data) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/user/bindRelationUser`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

//场地列表
export function getSiteList(data) {
  return request({
    url: `${expertUrl}/expert/site/site/pagelist`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

//场地收藏
export function collectSite(data) {
  return request({
    url: `http://172.18.0.222:8888/buyer/passport/member/user/collect`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

export function sendLoginSms(params) {
  return request({
    url: `/buyer/passport/member/userLogin`,
    method: Method.POST,
    needToken: true,
    params,
  });
}

// 获取合作伙伴
export function getPartnersList() {
  return request({
    url: `${managerUrl}/manager/home/setting/partners`,
    method: Method.Get,
    needToken: true,
  });
}

// 获取合作伙伴详情
export function getPartnerId(id) {
  return request({
    url: `${managerUrl}/manager/home/setting/partners/${id}`,
    method: Method.Get,
    needToken: true,
  });
}

//在线咨询-确认咨询
export function setConsulStatus(data) {
  return request({
    url: `${buyerUrl}/buyer/order/userConsult/save`,
    method: Method.POST,
    needToken: true,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
